/**
 * 
 */
package org.statewalker.parser.wiki.tokenizer.block;

import org.statewalker.parser.wiki.tokenizer.base.StreamToken;
import org.statewalker.tokenizer.base.AbstractTokenizer;
import org.statewalker.tokenizer.base.ITokenFactory;
import org.statewalker.tokenizer.stream.ICharStream;
import org.statewalker.tokenizer.stream.ICharStream.Pointer;

public class TableTokenizer extends AbstractTokenizer<StreamToken> {

    public TableTokenizer(ITokenFactory<StreamToken> factory) {
        super(factory);
    }

    public StreamToken read(ICharStream stream) {
        char ch = stream.getChar();
        Pointer startPos = null;
        boolean result = false;
        if (ch == '|') {
            startPos = stream.getPointer();
            result = true;
            stream.incPos();
        }
        return result ? newToken(startPos, stream.getPointer(), "|") : null;
    }
}